package org.small.shop.phone.api.process.goodsappraises.controller;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.small.shop.phone.api.process.goodsappraises.pojo.TblWxGoodsAppraisesVo;
import org.small.shop.phone.api.process.goodsappraises.service.TblWxGoodsAppraisesService;
import org.small.shop.phone.api.utils.ShopJSONResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TblWxGoodsAppraisesController {

	private static Logger logger = LoggerFactory.getLogger(TblWxGoodsAppraisesController.class);

	@Resource
	private TblWxGoodsAppraisesService tblWxGoodsAppraisesService;

	@PostMapping("/getAllApprsById")
	public ShopJSONResult getAllApprsById(TblWxGoodsAppraisesVo apprVo) {

		if (apprVo != null && apprVo.getGoodsId() != null) {
			try {
				TblWxGoodsAppraisesVo apprsVo = tblWxGoodsAppraisesService.selectAllApprByGoodsid(apprVo);
				if (apprsVo != null) {
					return ShopJSONResult.ok(apprsVo);
				}
			} catch (Exception e) {
				logger.info(e.getMessage());
			}
		}
		return ShopJSONResult.errorMsg("查看商品评论失败！");
	}

}
